package pojo;

import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;

/**
 * 
 * @author zgy
 * 
 */
@Repository
public class ZcUserAddr implements RowMapper<ZcUserAddr>, Serializable {

	private Integer id;
	private Integer userId;
	private Integer areaId;
	private String userName;
	private String userMp;
	private String area;
	private String address;
	private String def;

	public ZcUserAddr() {
		super();
		// TODO Auto-generated constructor stub
	}
	
	

	public ZcUserAddr(Integer id, Integer userId, Integer areaId,
			String userName, String userMp, String area, String address,
			String def) {
		super();
		this.id = id;
		this.userId = userId;
		this.areaId = areaId;
		this.userName = userName;
		this.userMp = userMp;
		this.area = area;
		this.address = address;
		this.def = def;
	}



	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public Integer getAreaId() {
		return areaId;
	}

	public void setAreaId(Integer areaId) {
		this.areaId = areaId;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserMp() {
		return userMp;
	}

	public void setUserMp(String userMp) {
		this.userMp = userMp;
	}

	public String getArea() {
		return area;
	}

	public void setArea(String area) {
		this.area = area;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getDef() {
		return def;
	}

	public void setDef(String def) {
		this.def = def;
	}

	@Override
	public ZcUserAddr mapRow(ResultSet rs, int rowNum) throws SQLException {
		ZcUserAddr e = new ZcUserAddr();
		e.setId(rs.getInt("id"));
		/*e.setUserId(rs.getInt("user_id"));
		e.setAreaId(rs.getInt("area_id"));
		e.setArea(rs.getString("area"));*/
		e.setUserName(rs.getString("user_name"));
		e.setUserMp(rs.getString("user_mp"));
		e.setArea(rs.getString("area"));
		e.setAreaId(rs.getInt("area_id"));
		e.setAddress(rs.getString("address"));
		e.setDef(rs.getString("def"));
		return e;
	}
	
	public Object[] insertObjecParams(){
		Object[] params = new Object[]{userId,areaId,userName,userMp,area,address,def};
		return params;
	}
	
	public Object[] editObjecParams(){
		Object[] params = new Object[]{userName,userMp,address,def,id};
		return params;
	}

}
